wrong history type createLink for attribute name

I am trying to count the number of time the Object text of the object o has changed since last baseline using the code below.
History h
for h in o do
{ if (h.attrName == "Object Text")Count++ }

When I run the script, the following message is printed on the interaction window. Does any one what the message means?

-R-W- DXL: <C:\Program Files\IBM\Rational\DOORS\9.3/lib/dxl/addins/user/MetricsWeeklyChurn.dxl:102> wrong history type createLink for attribute name
Hanny - Fri Feb 04 08:31:55 EST 2011

Re: wrong history type createLink for attribute name
llandale - Fri Feb 04 13:47:34 EST 2011

Some of the History parameters are illegal depending on the type of History. In this case your script has come across a "CreateLink" history for which "attrName" is illegal (there is no attrName associated with creating a link).

You need to get familiar with noError() and lastError() to gracefully trap errors. Try this:

History h
int Count = 0
string NameAttr
for h in o do
{  NameAttr = ""
   noError()
   NameAttr = h.attrName
   ErrMess = lastError()
   // Ignore ErrMess, we don't care why there was an error
   if (NameAttr == "Object Text") Count++
}


Well, in this case since we don't care about individual errors, I'd move the "noError()" before the loop starts, and move the "lastError()" after the loop.

 

 

  • Louie

 

 

Re: wrong history type createLink for attribute name
SystemAdmin - Fri Feb 04 13:58:54 EST 2011

llandale - Fri Feb 04 13:47:34 EST 2011

Some of the History parameters are illegal depending on the type of History. In this case your script has come across a "CreateLink" history for which "attrName" is illegal (there is no attrName associated with creating a link).

You need to get familiar with noError() and lastError() to gracefully trap errors. Try this:

History h
int Count = 0
string NameAttr
for h in o do
{  NameAttr = ""
   noError()
   NameAttr = h.attrName
   ErrMess = lastError()
   // Ignore ErrMess, we don't care why there was an error
   if (NameAttr == "Object Text") Count++
}


Well, in this case since we don't care about individual errors, I'd move the "noError()" before the loop starts, and move the "lastError()" after the loop.

 

 

  • Louie

 

 

Or maybe just check for correct history event type (modifyAttr) before checking for attribute name?

Re: wrong history type createLink for attribute name
llandale - Fri Feb 04 14:22:59 EST 2011

SystemAdmin - Fri Feb 04 13:58:54 EST 2011
Or maybe just check for correct history event type (modifyAttr) before checking for attribute name?

HistoryType ht

ht = h.type
if (ht != modifyAttr) continue

Yes, that's what I usually do, but the original author (it seems) needed to know about noError and lastError().

  • Louie